package com.fang.networkdisk.controller;


import com.fang.common.common.CommonPage;
import com.fang.common.common.CommonResult;
import com.fang.common.request.BaseController;
import com.fang.common.util.CommonResultUtil;
import com.fang.networkdisk.entity.bo.LoginRecordBo;
import com.fang.networkdisk.entity.dto.LoginRecordDto;
import com.fang.networkdisk.entity.vo.LoginRecordVo;
import com.fang.networkdisk.service.TbNetDisLoginRecordService;
import com.fang.networkdisk.util.NDBeanUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Description
 * @Author Bernie_fang
 * @Date 2025/1/18 20:31
 **/
@RestController
@RequestMapping("/system/loginRecord")
public class LoginRecordController extends BaseController {

    @Resource
    private TbNetDisLoginRecordService tbNetDisLoginRecordService;

    @PostMapping("/list")
    public CommonResult<CommonPage<List<LoginRecordVo>>> queryLoginRecord(@RequestBody LoginRecordDto loginRecord) {
        LoginRecordBo loginRecordBo = new LoginRecordBo();
        NDBeanUtils.copyListProperties(loginRecord, loginRecordBo);
        CommonPage result = tbNetDisLoginRecordService.queryLoginRecord(loginRecordBo);
        return CommonResultUtil.success(result);
    }

}
